<template>
    <div class="title">饿了么</div>
    <div class="business-list">
    <van-card
        v-for="business of businessList"
        :title="business.name"
        :desc="business.description"
        :thumb="business.mainImage"
        @click="$router.push(`/business/detail?id=${business.id}`)"

    />
    </div>
</template>

<script>

export default {
    name: "list",
    data(){
        return{
            businessList:[]
        }
    },
    methods:{
        _initBusinessLst(){
        this.$axios.get('/ele_server/business/list').then(({ data:res }) =>{
            if(res.data.status == 0){
                this.businessList= res.data.data
            } else{
                alert(res.message)
            }
        })
        }
    },
    created() {
        this._initBusinessLst()
    }
}
</script>

<style scoped lang="stylus">
.title
    color #1989fa
    display flex
    justify-content center
    margin 10px
    font-weight bold
    font-size 20px
</style>
